function SDX_GeneralFunctions(_RootObject)
{
 this.RootObject = _RootObject ;
 this.GarbageArray=GarbageArray;
 this.XMLHTTP = XMLHTTP ;
 this.SendData = SendData ;
 this.CloneArray = CloneArray ;
 function GarbageArray(aArray)
 {
  var aTemp=new Array()
  var nX=0
  for(var nX in aArray)
   if(aArray[nX]!=null)
    aTemp[aTemp.length]=aArray[nX]
  return aTemp
 }
 function CloneArray(_Array)
 {
  var array = new Array() ;
  for(var nX in _Array)
  {
   array[nX] = _Array[nX] ;
  }
  return array;

 }
 function XMLHTTP(_RootObject)
 {
  this.RootObject = _RootObject ;
  var xmlhttp=false;
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
  }
  if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
  }
  if (!xmlhttp) {
    try{
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	} catch (e) {
		xmlhttp=false;
	}
  }
  return xmlhttp ;
 }
 function SendData(_RootObject)
 { 
  _RootObject.Tables.Tables[0].Navigator.SetStatusToUpdating();
  xmlhttp = this.XMLHTTP(this.RootObject) ;
  xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  
  xmlhttp.open("POST", window.location,false);
  xmlhttp.onreadystatechange=function() {
   if (xmlhttp.readyState==4) {
    var response = xmlhttp.responseText ;
    if(response.split("\n")[0].indexOf("true") > -1 )
    {
		_RootObject.Datas.AcceptChanges()
		_RootObject.Initialize()
		if(response.split("\n").length > 2 )
		{
        _RootObject.Tables.Tables[0].Navigator.SetStatusToFailed();
//		    alert( response.replace("true","") )
		}
	}
    else
    {
        _RootObject.Tables.Tables[0].Navigator.SetStatusToDone();
        setTimeout(_RootObject.Tables.Tables[0].Navigator.GetEvalObjectString() + ".SetStatusToNormal()",5000)
//	    alert(response)
	}
   }
  }

  xmlhttp.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  xmlhttp.send("<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
               "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
               "<soap:Body>" +
               "<JLXGridResponse xmlns=\"http://tempuri.org/\">" +
               "<JLXGridResult><![CDATA[" + this.RootObject.Datas.DiffGramXML() + "]]></JLXGridResult>" +
               "</JLXGridResponse>" +
               "</soap:Body>" +
               "</soap:Envelope>") ;
 }
}
